<template>
  <div>
    <el-image
      v-for="url in srcList"
      :key="url"
      :src="url"
      :preview-src-list="srcList"
      :style="styleObject"
      fit="cover"
    >
    </el-image>
  </div>
</template>
<script>
import { fileFormat } from "@/util/upload";

export default {
  name: "SImgPreview",
  props: {
    data: {
      type: String,
      default: null
    },
    size: {
      type: Number,
      default: 148
    }
  },
  data() {
    return {
      srcList: [],
      styleObject: {
        width: this.size + "px",
        height: this.size + "px",
        marginRight: "15px",
        borderRadius: "8px"
      }
    };
  },
  mounted() {
    this.urlFormat();
  },
  methods: {
    urlFormat() {
      this.srcList = fileFormat(this.data);
    }
  }
};
</script>
